let data = { 
  pagenum : 1,
  pagesize : 8,
}
let total
let index = 8
function fn(){
if(index >= total){
  return  layer.msg('没有更多内容了');
  index=8
  }
$.ajax({
  type :'GET',
  url :'http://localhost:8888/api/articles',
  data : data,
  success : function(res){
    console.log(res);
    if(res.status === 0){
      total = res.total
      // console.log(total);
      str =''
      res.data.forEach(item => {
        // console.log(item.title);
         
        str += `<div class="item">
        <h4>
          <a href="./detail.html?id=${item.id}">${item.title}</a>
        </h4>
        <p class="meta">
          <span>${item.pub_date}} 分享至</span>
          <a href="javascript:;" class="wechat"></a>
          <a href="javascript:;" class="weibo"></a>
        </p>
        <p class="brief">${item.content}</p>
      </div>`
        
      });

      $('.info').html(str)
    }
  }
})
}
fn()

$('.kr_more').on('click',function(){
  index += 2
  data.pagesize += 2
 fn()
})